const mongoose = require('mongoose')
mongoose.Promise = global.Promise

const Schema = mongoose.Schema

// Schema
const initSchema = new Schema({
  user_name: { type: String, required: [true, '用户名不能为空'] },
  phone_num: { type: String, required: [true, '手机号不能为空'] },
  password: { type: String, required: [true, '密码不能为空'] },
  age: { type: Number },
  create_time: { type: String, default: '' },
  update_time: { type: String, default: '' },
  token: String
})

// Model
const model = mongoose.model('users', initSchema)

module.exports = model
